#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:

    bool solve(string A, string B) {
        if (A.size() != B.size()) return false;
        A = A + A;
        return strstr(A.c_str(), B.c_str()) != nullptr;
    }
};